
<div id="contentAll" class="f-l">
	<form action="<?php echo base_url('panel/facturacion_rpt'); ?>" method="get" id="frmFiltrosCotiza" class="frmfiltros corner-all8 btn-gray">
		<label for="ffecha1">Fecha:</label> 
		<input type="text" name="ffecha1" id="ffecha1" value="<?php echo set_value_get('ffecha1', $fecha); ?>" size="10">
		<input type="hidden" name="pag" id="pagina_sel" value="">
		
		<input type="submit" name="enviar" value="Enviar" class="btn-blue corner-all">
	</form>
	
	<input type="hidden" name="pag_sel" id="pag_sel" value="<?php echo set_value_get('pag'); ?>">
	
	<?php if($fact['cerrado']){ ?>
	<div class="a-c" style="color: #008800;font-weight: bold;">Día Revisado</div>
	<?php } ?>
	<table class="tblListados corner-all8">
		<tr class="header btn-gray">
			<td>Fecha</td>
			<td>Folio</td>
			<td>Cliente</td>
			<td>Total</td>
			<td>Status</td>
			<td>Observaciones</td>
			<td class="a-c">Opc</td>
		</tr>
<?php 
	$readly = ' disabled';
	if($this->empleados_model->tienePrivilegioDe('', 'facturacion_rpt/revisar/') && $fact['cerrado'] == false)
		$readly = '';
	
	foreach($fact['fact'] as $factu){
		$status = 'Pendiente';
		if($factu->status == 'pa')
			$status = 'Pagada';
		elseif($factu->status == 'ca')
			$status = 'Cancelada';
		
		$checked = '';
		if($factu->revisado == 't')
			$checked = ' checked';
?>
		<tr>
			<td><?php echo $factu->fecha; ?></td>
			<td><?php echo ($factu->serie!=''? $factu->serie.'-': '').$factu->folio; ?></td>
			<td><?php echo $factu->nombre_fiscal; ?></td>
			<td><?php echo String::formatoNumero($factu->total); ?></td>
			<td><?php echo $status; ?></td>
			<td style="width: 353px;">
				<textarea rows="2" cols="40" class="observ_chn" id="observa<?php echo str_replace('.', '_', $factu->id_factura); ?>" 
					data-id="<?php echo $factu->id_factura; ?>"<?php echo $readly; ?>><?php echo $factu->observaciones; ?></textarea>
			</td>
			<td style="width: 30px;">
				<input type="checkbox" name="fac_revisado" value="si" class="revisado_chn" 
					id="revisado<?php echo str_replace('.', '_', $factu->id_factura); ?>" 
					data-id="<?php echo $factu->id_factura; ?>"<?php echo $readly.$checked; ?>>
			</td>
		</tr>
<?php }?>
	</table>
	
<?php 
if($readly == ''){ ?>
	<input type="button" name="enviar" value="Cerrar Día" id="btnCerrarDia" class="btn-blue corner-all">
<?php
}

//Paginacion
$this->pagination->initialize(array(
		'base_url' 			=> base_url($this->uri->uri_string()).'?'.String::getVarsLink(array('pag')).'&',
		'total_rows'		=> $fact['total_rows'],
		'per_page'			=> $fact['items_per_page'],
		'cur_page'			=> $fact['result_page']*$fact['items_per_page'],
		'page_query_string'	=> TRUE,
		'num_links'			=> 1,
		'anchor_class'		=> 'pags corner-all'
));
$pagination = $this->pagination->create_links();
echo '<div class="pagination w100">'.$pagination.'</div>'; 
?>
</div>

<!-- Bloque de alertas -->
<div id="container" style="display:none">
	<div id="withIcon">
		<a class="ui-notify-close ui-notify-cross" href="#">x</a>
		<div style="float:left;margin:0 10px 0 0"><img src="#{icon}" alt="warning" width="64" height="64"></div>
		<h1>#{title}</h1>
		<p>#{text}</p>
		<div class="clear"></div>
	</div>
</div>
<?php if(isset($frm_errors)){
	if($frm_errors['msg'] != ''){ 
?>
<script type="text/javascript" charset="UTF-8">
$(function(){
	create("withIcon", {
		title: '<?php echo $frm_errors['title']; ?>', 
		text: '<?php echo $frm_errors['msg']; ?>', 
		icon: '<?php echo base_url('application/images/alertas/'.$frm_errors['ico'].'.png'); ?>' });
});
</script>
<?php }
}?>
<!-- Bloque de alertas -->
